#pragma once

namespace Melting
{
	namespace Parallel
	{
		// contains :
		// TaskFuncParams
		// TaskFunc
		// Task
	 
		//--------------------------------------------------------------------------------------------------------------------
		// WARNING : this struct is 32bytes wide, and must remain like this ! - cf. TaskManager::TaskInfo struct
		struct TaskFuncParams
		{ 
			union // 32 bytes ! 
			{ 
				//UINT8			mData8[4];
				//UINT16			mData16[2];
				//UINT32			mData32[1];
				//UINT8			mData8[16];
				//UINT16			mData16[8];
				//UINT32			mData32[4];
				UINT8			mData8[32];
				UINT16			mData16[16];
				UINT32			mData32[8];
			};
		}; 
		//--------------------------------------------------------------------------------------------------------------------
		typedef void (*TaskFunc) ( const TaskFuncParams& _rParams ); 

		//--------------------------------------------------------------------------------------------------------------------
		struct Task
		{
			TaskFuncParams	mParams;	///< Data/Parameters passed to the TaskFunc
			TaskFunc		mFunc;		///< Function executed by the Task

			inline void Execute( void ) const
			{
				mFunc( mParams );
			}
		};

	}// namespace Parallel

}// namespace Melting